<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2024/4/30
  Time: 14:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>学生信息页面</title>
    <style type="text/css">
        .active {
            background-color: aquamarine;
        }
        .even{
            background-color: aquamarine;
        }
    </style>
</head>
<body>
<form action="stuListPage" method="post" enctype="application/x-www-form-urlencoded">
    <table border="1" width="90%" align="center">
        <tr>
            <th>编号</th>
            <th>姓名</th>
            <th>学号</th>
            <th>身份证号</th>
            <th>入学时间</th>
            <th>权限</th>
            <th>操作</th>
        </tr>
        <c:forEach var="stu" items="${pageBean.data}" varStatus="status">
            <tr class="${status.index % 2 == 0 ? 'even' : 'odd'}">
                <td>${stu.id}</td>
                <td>${stu.stuname}</td>
                <td>${stu.stuno}</td>
                <td>${stu.idcard}</td>
                <td>
                    <fmt:formatDate value="${stu.startdate}" pattern="yyyy-MM-dd"></fmt:formatDate>
                </td>
                <td>
                    <c:if test="${stu.status==1}">
                        <p>管理员</p>
                    </c:if>
                    <c:if test="${stu.status==0}">
                        <p>学生</p>
                    </c:if>
                </td>
                <td>
                    <c:url var="deleteUrl" value="deleteStu">
                        <c:param name="id" value="${stu.id}"></c:param>
                    </c:url>
                    <a href="${deleteUrl}" onclick="return confirm('是否删除？')">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</form>
<div style="width: 90%; margin: 0 auto;">
    【${pageBean.pageNum}/${pageBean.pageCount}】
    <a href="showStu?pageNum=1&pageSize=${pageBean.pageSize}">首页</a>
    <a href="showStu?pageNum=${pageBean.pageNum-1}&pageSize=${pageBean.pageSize}">上一页</a>
    <c:forEach begin="${pageBean.startPage}" end="${pageBean.endPage}" var="num">
    <c:if test="${pageBean.pageNum==num}">
    <a class="active"
       href="showStu?pageNum=${num}&pageSize=${pageBean.pageSize}">${num}</a>
    </c:if>
    <c:if test="${pageBean.pageNum!=num}">
    <a href="showStu?pageNum=${num}&pageSize=${pageBean.pageSize}">${num}</a>
    </c:if>
    </c:forEach>
    <a href="showStu?pageNum=${pageBean.pageNum+1}&pageSize=${pageBean.pageSize}">下一页</a>
    <a href="showStu?pageNum=${pageBean.pageCount}&pageSize=${pageBean.pageSize}">尾页</a>
</body>
</body>
</html>
